package leetcodecompetition.S115;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: Siantar
 * @Date: 2023-10-14-22:53
 * @Description: 1.0
 */
public class T100078 {
    public List<String> getWordsInLongestSubsequence(int n, String[] words, int[] groups) {
        List<String> res = new ArrayList<>();
        int f = -1;
        for (int i = 0; i < n; i++) {
            if (groups[i] != f) {
                res.add(words[i]);
                f = groups[i];
            }
        }
        return res;
    }
}
